//
//  BaseModel.m
//  FrameWork
//
//  Created by dlios on 15/7/1.
//  Copyright (c) 2015年 SJF1992. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel

- (void)dealloc
{
    [super dealloc];

}



- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}

- (id)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

+ (id)baseModelWith:(NSDictionary *)dic
{
    id objc = [[[self class] alloc] initWithDic:dic];
    return objc;
}


+(NSMutableArray *)arrWithModelByArr:(NSArray *)array
{
    //创建一个可变数组 保存model
    NSMutableArray *arr = [NSMutableArray array];
    for (NSDictionary *dic in array) {
        // 创建对象
        id model= [[self class] baseModelWith:dic];
        [arr addObject:model];
    }
    return arr;
}



@end
